package bas.item;

import java.util.ArrayList;

import bas.file.FileIO;
import bas.list.CreationRequestList;
import bas.list.DeletionRequestList;

public class Administrator
{
    private String adminId;
    private String adminPw;
    private CreationRequestList creationList;
    private DeletionRequestList deletionList;

    public Administrator(String pw)
    {
        adminId = "admin";
        adminPw = pw;
        creationList = new CreationRequestList();
        deletionList = new DeletionRequestList();
    }

    public boolean createAccount()
    {
    	boolean isCreated = false;
        if(creationList.getListLength() != 0)
        {
            for(int i = 0; i < creationList.getListLength(); i++)
            {
                isCreated = FileIO.setAccNum(creationList.getListItem(i));
            }
        }
        else
        {
        	isCreated = false;
        }
        FileIO.requestComplete();
        return isCreated;
    }

    public void deleteAccount()
    {
        if(deletionList.getListLength() != 0)
        {
            for(int i = 0; i < deletionList.getListLength(); i++)
            {
            	ArrayList<String> list = FileIO.get(deletionList.getListItem(i));
                FileIO.deleteAcc(list.get(5));
            }
        }
    }
    
    public void displayUserAccount(String id)
    {
        ;
    }
    
    public boolean modifyPassword(String changePw)
    {
        return FileIO.changeAdminPw(changePw);
    }
}
